<template>
	<div id="cpuPart">
		<el-form label-width="140px" label-position="left" size="mini" ref="cpuForm">
			<el-form-item label="CPU">
				<el-select v-model="info.cpuNum"
						   style="width:50%;"
						   @change="changeCPUNum"
						   :disabled="cpuDis">
					<el-option v-for="item in cpuNumData"
							   :key="item.value"
							   :label="item.text"
							   :value="item.value">
					</el-option>
				</el-select>
				<template v-if="modetype !== 'editVmTem'">
					<el-checkbox v-model="info.cpuHotplugEnabled"
								 :disabled='cpuHotDis'
								 style="margin-right: 0;">
						开启热插拔
					</el-checkbox>
					<el-tooltip placement="right">
						<div slot="content" v-html="CPUTip"></div><span class="icon-info"></span>
					</el-tooltip>
				</template>
			</el-form-item>
			<el-form-item label="每个插槽内核数">
				<el-select v-model="info.cpuCore"
						   style="width:50%;"
						   :disabled="cpuDis">
					<el-option v-for="item in cpuCoreData"
							   :key="item.value"
							   :label="item.text"
							   :value="item.value">
					</el-option>
				</el-select>
				<span>插槽数{{cpuSocket}}</span>
			</el-form-item>
			<template v-if="modetype !== 'editVmTem' && modetype !== 'importVm'">
				<el-form-item label="numa感知">
					<el-checkbox v-model="info.awareNumaEnabled"
								 @change="changeAwareNuma"
								 :disabled="awareNumDis">
						是否开启numa感知
					</el-checkbox>
					<el-tooltip placement="right">
						<div slot="content" v-html="NumaTip"></div><span class="icon-info"></span>
					</el-tooltip>
				</el-form-item>
			</template>
			<template v-if="modetype !== 'editVmTem'">
				<div class="ics-panel-title ics-panel-pointer" @click="showCpuResPanelFun">
					<h5>CPU资源控制</h5>
					<span :class="['el-collapse-item__arrow', showCpuResPanel ? 'el-icon-arrow-right is-active' : 'el-icon-arrow-right']"></span>
				</div>
				<el-collapse-transition>
					<div v-show="showCpuResPanel">
						<el-form-item label="CPU份额">
							<el-select v-model="info.cpuShares" :disabled="info.cpuReservation > 0" style="width:50%;">
								<el-option v-for="item in cpuSharesData"
										   :key="item.value"
										   :label="item.text"
										   :value="item.value">
								</el-option>
							</el-select>
							<el-tooltip palcement="right">
								<div slot="content" v-html="CPUSharesTip"></div><span class="icon-info"></span>
							</el-tooltip>
						</el-form-item>
						<template v-if="modetype !== 'importVm'">
							<el-form-item label="CPU限制">
								<el-select v-model="info.cpuLimit"
										   :disabled="info.cpuReservation > 0"
										   filterable
										   style="width:50%;"
										   @blur.native.capture="inputCpuLimit"
										   @change="changeCpuLimit"
										   data-type="input"
										   v-validate-easy="rules.cpuLimit"
										   name="cpuLimit"
										   ref="cpuLimit"
										   key="cpuLimit">
									<el-option v-for="item in cpuLimitData"
											   :key="item.value"
											   :label="item.text"
											   :value="item.value">
									</el-option>
								</el-select>
								<span>MHz</span>
								<el-tooltip placement="right">
									<div slot="content" v-html="CPULimitTip"></div><span class="icon-info"></span>
								</el-tooltip>
							</el-form-item>
							<el-form-item>
								<span class="ics-hinttext">CPU限制设置过小，会导致虚拟机运行缓慢，可能影响虚拟机中某些程序（例如ICS VM TOOLS）的正常运行。</span>
							</el-form-item>
							<el-form-item label="CPU预留">
								<el-input v-model.number="info.cpuReservation"
								data-type="input"
								v-validate-easy="rules.cpuReservation"
								name="cpuReservation"
								:disabled="cpuResDis"
								ref="cpuReservation"
								class="el-input-inline">
								</el-input>
								<el-tooltip placement="right">
									<div slot="content" v-html="CPUReserTip"></div><span class="icon-info"></span>
								</el-tooltip>
							</el-form-item>
						</template>
					</div>
				</el-collapse-transition>
				<template v-if="modetype !== 'importVm'">
					<div>
						<h5></h5>
						<span></span>
					</div>
					<el-collapse-transition>
						<div v-show="showCPUBind">
							<el-form-item label="可使用CPU数量">
							</el-form-item>
							<el-form-item label="提示">
							</el-form-item>
							<el-form-item label="绑定CPU">
							</el-form-item>
						</div>
					</el-collapse-transition>
				</template>
			</template>
		</el-form>
	</div>
</template>

<script>
</script>

<style>
</style>
